#!/bin/bash

echo "🔨 开始构建多模块PF4J项目..."

echo "📦 清理并安装所有模块到本地Maven仓库..."
mvn clean install -DskipTests

echo "📋 复制插件到plugins目录..."
mkdir -p pf4j-host/plugins
cp pf4j-plugin-greeting/target/pf4j-plugin-greeting-0.0.1-SNAPSHOT.jar pf4j-host/plugins/

echo "✅ 多模块构建完成！"
echo "📁 项目结构:"
echo "  - pf4j-api: 扩展点接口模块"
echo "  - pf4j-host: 宿主应用模块"
echo "  - pf4j-plugin-greeting: 问候插件模块"
echo ""
echo "🚀 插件文件位置: pf4j-host/plugins/pf4j-plugin-greeting-0.0.1-SNAPSHOT.jar"
echo "💡 运行应用: cd pf4j-host && mvn spring-boot:run"
